<script src="vue.js"></script>
<div id="app">
   
    <button @click="add">添加</button>
    
    <table border="1">
        <tr>
            <td>工号</td>
            <td>姓名</td>
            <td>联系电话</td>
            <td>操作</td>
        </tr>
        <tr v-for="item in terList">
            <td>{{item.cord}}</td>
            <td>{{item.uname}}</td>
            <td>{{item.tel}}</td>
           <td>
            <button @click="del">删除</button>
            <button @click="update">修改</button>
            <button @click="add">添加</button>
    
           </td>
           
        </tr>
    </table>
</div>
<script>
    var  vue=new Vue({
        el: '#app',
        data:{
            //
            terList: []
        },
        methods:{
            add(){
                console.log("进入添加方法")
                //
                var terache={
                    cord:"001",
                    uname:"李老师",
                    tel:"13102555642"
                };
                //
                this.terList.push(terache);
            },
            update(){
                alert("准备开始更新数据")
            },
            del(){
                //
                this.terList.pop();
            }
        }
    }) 
</script>

